# include <iostream>
#include <vector>
using namespace std;
class Person{
public:
    Person(string name,int age){
        mName=name;
        mAge=age;
    }
public:
    string mName;
    int mAge;
};
void test01(){
    vector <Person>v;
    Person p1("aaa",12);
    Person p2("aaa",12);
    Person p3("aaa",12);
    Person p4("aaa",12);
    Person p5("aaa",12);
    Person p6("aaa",12);
    v.push_back(p1);
    v.push_back(p2);
    v.push_back(p1);
    v.push_back(p1);
    v.push_back(p1);
    v.push_back(p1);
    for(vector<Person>::iterator it=v.begin();it!=v.end();it++){
        cout<<"name"<<(*it).mName<<"age"<<(*it).mAge<<endl;
    }
}
void test02(){
    vector<Person*>v;
    Person p1("aaa",12);
    Person p2("aaa",12);
    Person p3("aaa",12);
    Person p4("aaa",12);
    Person p5("aaa",12);
    Person p6("aaa",12);
    v.push_back(&p1);
    v.push_back(&p1);
    v.push_back(&p1);
    v.push_back(&p1);
    v.push_back(&p1);
    v.push_back(&p1);
    v.push_back(&p1);
    v.push_back(&p1);

    for(vector<Person*>::iterator it=v.begin();it!=v.end();it++){
        cout<<"name"<<(*it)->mName<<"age"<<(*it)->mAge<<endl;
    }
}
int main() {
//test01();
test02();
    return 0;
}
